<?php

	// Make sure we are authenticated
	require_once('scripts/authentication.php');
	
	// Establish a connection to the database
	require_once('scripts/dbconnection.php');
	
	/* Statistics */
	
	// Number of Books
	$result = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS no FROM BOOK"));
	$noOfBooks = $result["no"];
	
	// Number of Authors
	$result = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS no FROM AUTHOR"));
	$noOfAuthors = $result["no"];
	
	// Number of Subjects
	$result = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS no FROM SUBJECTS"));
	$noOfSubjects = $result["no"];
	
	// Get the MySQL Server version
	$mysqlVersion = mysql_get_server_info();
	
	// Get the PHP version
	$phpVersion = phpversion();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
		<title>eLibrary Administration : About</title>
		<link href="style/defaults.css" rel="stylesheet" type="text/css" media="all" />
		<link href="style/elements.css" rel="stylesheet" type="text/css" media="all" />
	</head>
	<body>
		
		<div class="header">
			<h1><a href="index.php">eLibrary</a></h1>
			<h3>Administer your library.</h3>
		</div>
		
		<div class="container">
			<div class="column">
				<img src="images/book.png" width="220" height="220" />
			</div>
			<div class="column">
				<h4>About eLibrary</h4>
				<p>eLibrary is a creation of Craig, Scott and Stephen.</p>
				<p>You can use the program to manage your collection of books including information relating to authors and subjects. You can also use the search section to search using the Title, Call No, Author or Subject.</p>
				<p>This program was developed using PHP and MySQL. It uses CSS and XHTML to render the pages.</p>
			</div>
			<div class="column">
				
				<div class="darkCol">
					<h5>Statistics</h5>
					<p>No. of Books: <?php echo $noOfBooks; ?></p>
					<p>No. of Authors: <?php echo $noOfAuthors; ?></p>
					<p>No. of Subjects: <?php echo $noOfSubjects; ?></p>
				</div>
				
				<div class="darkCol">
					<h5>eLibrary</h5>
					<p>Software Version: 0.1 (Revision 38)</p>
					<p>MySQL Version: <?php echo $mysqlVersion; ?></p>
					<p>PHP Version: <?php echo $phpVersion; ?></p>
				</div>
				
			</div>
			
			<div class="clear"></div>
		</div>
	</body>
</html>